function reseveArr(arr) {
    for (let i = 0; i < arr.length / 2; i++) {
        [arr[i], arr[arr.length - i - 1]] = [arr[arr.length - i - 1], arr[i]] // 减1 很有必要
    }
}

let arr = [1, 4, 9, 5]
reseveArr(arr)
console.log(arr)